package com.bdc.Spark

import org.apache.spark.sql.SQLContext
import org.apache.spark.{SparkConf, SparkContext}

/**
  * Spark使用JDBC方式查询Phoenix中的数据
  */
object SparkQueryPhoenixData {

  def main(args: Array[String]): Unit = {

    val jdbcPhoenixUrl = "jdbc:phoenix:slave1,slave2,slave3:2181/hbase"
    val tableName = "table_name"
    val conf = new SparkConf().setAppName("SparkQueryPhoenixData")
    val sc = new SparkContext(conf)
    val sqlContext = new SQLContext(sc)
    val data = sqlContext.load("org.apache.phoenix.spark", Map("table" -> tableName, "zkUrl" -> jdbcPhoenixUrl))

  }
}
